<template>
    <HomePannel title="最新专题" class="home-pannel">
        <template #main>
            <ul class="special-list">
                <li v-for="item in goodslist" :key="item.id">
                    <router-link to="/">
                        <img v-lazy="item.detailsUrl" alt="">
                        <div class="meta">
                            <p class="title">
                                <span class="top-title ellipsis">{{item.title}}</span>
                                <span class="sub-title ellipsis">{{item.summary}}</span>
                            </p>
                            <span class="price">￥{{item.lowestPrice}}起</span>
                        </div>
                    </router-link>
                    <!-- 底部部分 -->
                     <div class="foot">
                        <span class="like"><i class="iconfont icon-hart1"></i>{{item.collectNum}}</span>
                        <span class="view"><i class="iconfont icon-see"></i>{{item.viewNum}}</span>
                        <span class="reply"><i class="iconfont icon-message"></i>{{item.replyNum}}</span>
                     </div>
                </li>
            </ul>
        </template>
    </HomePannel>
</template>

<script>
import HomePannel from './HomePannel.vue'
import { getSpecialAPI } from '@/api/home'
import { ref } from 'vue'
export default {
  components: {
    HomePannel
  },
  setup () {
    const goodslist = ref([])
    getSpecialAPI().then(data => {
    //   console.log(data)
      goodslist.value = data.result
    })

    return { goodslist }
  }
}
</script>

<style lang="less" scoped>
.home-pannel{
    background: #f5f5f5;
}
.special-list{
    display: flex;
    justify-content: space-between;
    li{
        position: relative;
        width: 404px;
        height:360px;
        background: #fff;
        .hoverShadow();
        img{
            width: 100%;
            height: 288px;
        }
        .meta{
            background-image: linear-gradient(to top,rgba(0, 0, 0, 0.8),transparent 30%);
            display: flex;
            position: absolute;
            top:0;
            left: 0;
            width: 100%;
            height: 288px;
            .title{
                position: absolute;
                bottom: 0;
                left: 0;
                width: 70%;
                height: 70px;
                color: #fff;
                padding-left: 16px;
                .top-title{
                    color: #fff;
                    font-size: 22px;
                    display: block;
                }
                .sub-title{
                    display: block;
                    font-size: 19px;
                    color: #999;
                }
            }
            .price{
                position: absolute;
                bottom: 25px;
                right: 16px;
                line-height: 1;
                background: #fff;
                color: @priceColor;
                font-size: 18px;
                text-align: center;
                padding: 4px 8px 4px 7px;
                border-radius: 2px;
            }
        }
         .foot {
            height: 72px;
            line-height: 72px;
            padding: 0 20px;
            font-size: 16px;

            i {
                display: inline-block;
                width: 15px;
                height: 14px;
                margin-right: 5px;
                color: #999;
            }
            .like,
            .view {
                float: left;
                margin-right: 25px;
                vertical-align: middle;
            }
            .reply {
                float: right;
                vertical-align: middle;
            }
        }
    }
}
</style>
